home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / +ORC / Orc pac A / HOWTOA1.TXT < prev    next >
Encoding:
Text File  |  2000-05-25  |  18.4 KB  |  341 lines

  1.                      HOW TO CRACK, by +ORC, A TUTORIAL
  2.  
  3. ---------------------------------------------------------------------------
  4.  
  5.           Lesson A.1: Advanced Cracking: Internet Cracking (Unix)
  6.  
  7. ---------------------------------------------------------------------------
  8.  
  9. ------------->   INTERNET CRACKING: FIREWALLS
  10.      With each new company that connects to the "Information
  11. Superhighway" new frontiers are created for crackers to explore.
  12. Site administrators (Siteads) have implemented various security
  13. measures to protect their internal networks. One of these is
  14. xinetd, covered later. A more general solution is to construct
  15. a guarded gateway, called a [Firewall], that sits between a
  16. site's internal network and the wild and woolly Internet where
  17. we roam. In fact only one third of all Internet connected
  18. machines are already behind firewalls. Most information services
  19. have to deal with the same problem we have: getting OUT through
  20. a local firewall or GETTING INTO a service through their
  21. Firewall. There lays also the crack_solution.
  22. ------------>         What is a Firewall?
  23.      The main purpose of a Firewall is to prevent unauthorized
  24. access between networks. Generally this means protecting a site's
  25. inner network from the Internet. If a site has a firewall,
  26. decisions have been made as to what is allowed and disallowed
  27. across the firewall. These decisions are always different and
  28. always incomplete, given the multiplicity of Internet, there are
  29. always loopholes where a cracker can capitalize on.
  30.      A firewall basically works by examining the IP packets that
  31. travel between the server and the client. This provides a way to
  32. control the information flow for each service by IP address, by
  33. port and in each direction.
  34.      A firewall embodies a "stance". The stance of a firewall
  35. describes the trade-off between security and ease-of-use. A
  36. stance of the form "that which is not expressly permitted is
  37. prohibited" requires that each new service be enabled
  38. individually and is seldom used, coz very slow and annoying.
  39. Conversely, the stance "that which is not expressly prohibited
  40. is permitted" has traded a level of security for convenience. It
  41. will be useful to guess the stance of the firewall you are
  42. cracking when making probe decisions.
  43.      A firewall has some general responsibilities:
  44. *    First and foremost if a particular action is not allowed by
  45. the policy of the site, the firewall must make sure that all
  46. attempts to perform the action will fail.
  47. *    The firewall should log suspicious events
  48. *    The firewall should alert internal administration of all
  49. cracking attempts
  50. *    Some firewall provide usage statistics as well.
  51.  
  52. ------------>          Types of Firewall
  53.      In order to avoid head-scratching, it's a good idea to know
  54. the TOPOLOGY of "your" firewall -and its limitations- before
  55. attempting to get through it. Discussed below are two popular
  56. firewall topologies. Although other types exist, the two below
  57. represent the basic forms; most other firewalls employ the same
  58. concepts and thus have -luckily- the same limitations.
  59.                    1) THE DUAL-HOMED GATEWAY
  60.      A dual-homed Gateway is a firewall composed of a single
  61. system with at least two network interfaces. This system is
  62. normally configured such that packets are not directly routed
  63. from one network (the Internet) to the other (the internal net
  64. you want to crack). Machines on the Internet can talk to the
  65. gateway, as can machines on the internal network, but direct
  66. traffic between nets is blocked.
  67.      In discussing firewalls, it's generally accepted that you
  68. should think of the inner network as a medieval castle. The
  69. "bastions" of a castle are the critical points where defence is
  70. concentrated. In a dual-homed gateway topology, the dual-homed
  71. host itself is called the [BASTION HOST].
  72.      The main disadvantage of a dual-homed gateway, from the
  73. viewpoints of the users of the network and us crackers alike, is
  74. the fact that it blocks direct IP traffic in both directions. Any
  75. programs running on the inner network that require a routed path
  76. to external machines will not function in this environment. The
  77. services on the internal network don't have a routed path to the
  78. clients outside. To resolve these difficulties, dual-homed
  79. gateways run programs called [PROXIES] to forward application
  80. packets between nets. A proxy controls the conversation between
  81. client and server processes in a firewalled environment. Rather
  82. than communicating directly, the client and the server both talk
  83. to the proxy, which is usually running on the bastion host
  84. itself. Normally the proxy is transparent to the users.
  85.      A proxy on the bastion host does not just allow free rein
  86. for certain services. Most proxy software can be configured to
  87. allow or deny forwarding based on source or destination addresses
  88. or ports. Proxies may also require authentication of the
  89. requester using encryption- or password-based systems.
  90.      The use of proxy software on the bastion host means that the
  91. firewall administrator has to provide replacements for the
  92. standard networking clients, a nightmare in heterogeneous
  93. environments (sites with many different operating systems
  94. platforms, PC, Sun, IBM, DEC, HP...) and a great burden for
  95. administrator and users alike.
  96.                  2) THE SCREENED HOST GATEWAY
  97.      A screened host gateway is a firewall consisting of at least
  98. one router and a bastion host with a single network interface.
  99. The router is typically configured to block (screen) all traffic
  100. to the internal net such that the bastion host is the only
  101. machine that can be reached from the outside. Unlike the dual-
  102. homed gateway, a screened host gateway does not necessarily force
  103. all traffic through the bastion host; through configuration of
  104. the screening router, it's possible to open "holes" in the
  105. firewall to the other machines on the internal net you want to
  106. get into.
  107.      The bastion host in a screened host firewall is protected
  108. from the outside net by the screening router. The router is
  109. generally configured to only allow traffic FROM SPECIFIC PORTS
  110. on the bastion host. Further, it may allow that traffic only FROM
  111. SPECIFIC EXTERNAL HOSTS. For example the router may allow Usenet
  112. news traffic to reach the bastion host ONLY if the traffic
  113. originated from the site's news provider. This filtering can be
  114. easily cracked: it is relying on the IP address of a remote
  115. machine, which can be forged.
  116.      Most sites configure their router such that any connection
  117. (or a set of allowed connections) initiated from the inside net
  118. is allowed to pass. This is done by examining the SYN and ACK
  119. bits of TCP packets. The "start of connection" packet will have
  120. both bits set. If this packets source address is internal... or
  121. seems to be internal :=) the packet is allowed to pass. This
  122. allows users on the internal net to communicate with the internet
  123. without a proxy service.
  124.      As mentioned, this design also allows "holes" to be opened
  125. in the firewall for machines on the internal net. In this case
  126. you can crack not only the bastion host, but also the inner
  127. machine offering the service. Mostly this or these machine/s will
  128. be far less secure than the bastion host.
  129.      New services, for instance recent WEB services, contain a
  130. lot of back doors and bugs, that you'll find in the appropriate
  131. usenet discussion groups, and that you could use at freedom to
  132. crack inner machines with firewall holes. Sendmail is a good
  133. example of how you could crack in this way, read the whole
  134. related history... very instructive. The rule of thumb is "big
  135. is good": the bigger the software package, the more chance that
  136. we can find some security related bugs... and all packages are
  137. huge nowadays, 'coz the lazy bunch of programmers uses
  138. overbloated, buggy and fatty languages like Visual Basic or
  139. Delphy!
  140. Finally, remember that the logs are 'mostly) not on the bastion
  141. host! Most administrators collect them on an internal machine not
  142. accessible from the Internet. An automated process scan the logs
  143. regularly and reports suspicious information.
  144.  
  145.                  3) OTHER FIREWALL TOPOLOGIES
  146. The dual-homed gateway and the screened host are probably the
  147. most popular, but by no mean the only firewall topologies. Other
  148. configurations include the simple screening router (no bastion
  149. host), the screened subnet (two screening routers and a bastion
  150. host) as well as many commercial vendor solutions.
  151.  
  152. ------------>   Which software should we study?
  153. Three popular unix software solutions allow clients inside a
  154. firewall to communicate with server outside: CERN Web server in
  155. proxy mode, SOCKS and the TIS Firewall toolkit.
  156. 1)   The CERN Web server handles not only HTTP but also the other
  157. protocols that Web clients use and makes the remote connections,
  158. passing the information back to the client transparently. X-based
  159. Mosaic can be configured for proxy mode simply by setting a few
  160. environment variables.
  161. 2)   The SOCKS package (available free for anonymous ftp from
  162. ftp.nec.com in the file
  163.         /pub/security/socks.cstc/socks.cstc.4.2.tar.gz
  164. includes a proxy server that runs on the bastion host of a
  165. firewall. The package includes replacements for standard IP
  166. socket calls such as connect(), getsockname(), bind(), accept(),
  167. listen() and select(). In the package there is a library which
  168. can be used to SOCKSify your crack probes.
  169. 3)   The Firewall Toolkit
  170. The toolkit contains many useful tools for cracking firewall and
  171. proxy server. netacl can be used in inetd.conf to conceal
  172. incoming requests against an access table before spawning ftpd,
  173. httpd or other inetd-capable daemons. Mail will be stored in a
  174. chroot()ed area of the bastion for processing (mostly by
  175. sendmail).
  176. The Firewall toolkit is available for free, in anonymous ftp from
  177. ftp.tis.com in the file
  178.                /pub/firewalls/toolkit/fwtk.tar.Z
  179. The popular PC firewall solution is the "PC Socks Pack", for MS-
  180. Windows, available from ftp.nec.com It includes a winsock.dll
  181. file.
  182.  
  183.      The cracking attempts should concentrate on ftpd, normally
  184. located on the bastion host. It's a huge application, necessary
  185. to allow anonymous ftp on and from the inner net, and full of
  186. bugs and back doors. Normally, on the bastion host, ftpd is
  187. located in a chroot()ed area and runs as nonprivileged user. If
  188. the protection is run from an internal machine (as opposing the
  189. bastion host), you could take advantage of the special inner-net
  190. privileges in hostp.equiv or .rhosts. If the internal machine
  191. "trusts" the server machine, you'll be in pretty easily.
  192.      Another good method, that really works, is to locate your
  193. PC physically somewhere along the route between network and
  194. archie server and "spoof" the firewall into believing that you
  195. are the archie server. You'll need the help of a fellow hacker
  196. for this, though.
  197.      Remember that if you gain supervisor privileges on a machine
  198. you can send packets from port 20, and that in a screened host
  199. environment, unless FTP is being used in proxy mode, the access
  200. filters allow often connections from any external host if the
  201. source port is 20 and the destination port is greater than 1023!
  202.      remember that NCSA Mosaic uses several protocols, each on
  203. a different port, and that -if on the firewall no proxy Web
  204. server is operating- each protocol must be dealt with
  205. individually, what lazy administrators seldom do.
  206.      Be careful for TRAPS: networking clients like telnet and ftp
  207. are often viciously replaced with programs that APPEAR to execute
  208. like their namesake, but actually email an administrator. A
  209. fellow cracker was almost intercepted, once, by a command that
  210. simulated network delays and spat out random error messages in
  211. order to keep me interested long enough to catch me. Read the
  212. (fictions) horror story from Bill Cheswick: "An evening with
  213. Berferd in which a cracked is lured, endured and studied",
  214. available from ftp.research.att.com in
  215.               /dist/internet_security/berferd.ps
  216. As usual, all kind of traps can be located and uncovered by
  217. correct zen-cracking: you must *FEEL* that some code (or that
  218. some software behaviour) is not "genuine". Hope you believe me
  219. and learn it before attempting this kind of cracks.
  220.  
  221. ------------>      How do I crack Firewalls?
  222.      Some suggestions have been given above, but teaching you how
  223. to crack firewalls would take at least six complete tutorial
  224. lessons for a relatively unimportant cracking sector, and you
  225. would almost surely get snatched immediately, 'coz you would
  226. believe you can crack it without knowing nothing at all. So, for
  227. your sake, I'll teach you HOW TO LEARN IT, not HOW TO DO IT
  228. (quite a fascinating difference): First Text, then the software
  229. above. For text, start with Marcus Ranum's paper "Thinking about
  230. Firewalls", available from ftp.tis.com in the file/pub/firewalls/firewalls.ps.Z
  231. and do an archie search for newer literature.
  232. Join the firewall discussion list sending a message to
  233. majordomo@greatcircle.com, you'll get a message with
  234. instructions, as usual, lurk only... never show yourself to the
  235. others.
  236.      You can find for free on the web quite a lot of early
  237. versions of proxy software. Study it, study it and then study it
  238. again. The cracking efforts on your copies, and your machines,
  239. before attempting anything serious, are MANDATORY if you do not
  240. want to be immediately busted on the Internet. When you feel
  241. ready to try serious cracking, you must OBLIGATORY start with a
  242. small BBS which uses a firewall version you already studied very
  243. well (sysops are not firewall administrators, and many of them
  244. do not know nothing about the software they use). As soon as you
  245. gain access to the bastion host, remember to subvert entirely the
  246. firewall itself before entering the inner net.
  247. If you feel ready and everything went well so far, if your zen-
  248. cracking abilities are working well... then take a moment for
  249. yourself... prepare yourself a good Martini-Wodka (you should
  250. only use Moskovskaia), take a deep breath and by all means go
  251. ahead! You will then be able to try your luck on the Cyberspace
  252. and get quickly busted (if you did not follow my admonitions and
  253. if you cannot zen-crack) or, may be, fish quite a lot of
  254. jewels... :=)
  255.  
  256. ------------->     INTERNET CRACKING: XINETD
  257.      [Xinetd] a freely available enhanced replacement for the
  258. internet service daemon inetd, allows just those particular users
  259. to have FTP or Telnet access, without opening up access to the
  260. world. Xinetd can only protect the system from intrusion by
  261. controlling INITIAL access to most system services and by logging
  262. activities so that you can detect break-in attempts. However,
  263. once a connection has been allowed to a service, xinetd is out
  264. of the picture. It cannot protect against a server program that
  265. has security problems internally. For example, the finger server
  266. had a bug several years ago that allowed a particularly clever
  267. person to overwrite part of its memory. This was used to gain
  268. access to many systems. Even placing finger under the control of
  269. xinetd wouldn't have helped.
  270.      Think of the secured firewall system as a fortress wall:
  271. each service that is enabled for incoming connections can be
  272. viewed as a door or window in the walls. Not all these doors have
  273. secure and reliable locks. The more openings are available, the
  274. more opportunities are open for us.
  275. ------------->         What xinetd does
  276. Xinetd listens to all enabled service ports and permits only
  277. those incoming connection request that meet authorization
  278. criteria.
  279. -    Accept connections from only certain IP addresses
  280. -    Accept connections only from authorized users
  281. -    Reject connections outside of aithorized hours
  282. -    Log selected service when connections are accepted or
  283.      rejected, capturing following informations:
  284.      * Remote Host Address
  285.      * User ID of remote user (in some cases)
  286.      * Entry and Exit time
  287.      * Terminal type
  288.      Support login, shell, exec and finger
  289.  
  290. ------------->        SERVICES TO CRACK &
  291.                   UNWITTING INSIDE COMPLICES
  292. In this order the easy services:
  293.      FTP  TELNET    LOGIN (rlogin) SHELL (rcmd)   EXEC
  294. In this order the more difficult ones:
  295.      MOUNT     TFT  FINGER    NFS(Network File System)
  296.      DNS(Domain Name Service)
  297. Remember that sendmail (SMTP), by default, accepts a message from
  298. any incoming connection. The "sender" of such a message can
  299. appear to have originated anywhere, therefore your claim of
  300. identity will be accepted! Thus you can forge a message's
  301. originator. Most of the recipients inside the protected
  302. (firewalled) net will take your claim at face value and send you
  303. (to the "return address" you provide) all the sensitive
  304. information you need to crack the system. Finding unwitting
  305. inside complices is most of the time pretty easy.
  306.      By far the best method, for entering xinetd, is to get the
  307. real version from panos@cs.colorado.edu, modify the system files
  308. in order to have some backdoors, and then distribute them to the
  309. mirror servers on the WEB. Each time a new administrator will
  310. download "your" version of xinetd, you'll have an easy access to
  311. the "protected" system.
  312.      On the Nets, it's important to conceal your identity (they
  313. will find you out pretty quickly if you do not). The best method
  314. is to obtain the IP address of a legitimate workstation during
  315. normal hours. Then, late at night, when the workstation is known
  316. to be powered-off or disconnected from a dialup PPP link, a
  317. different node on the network can be configured to use the
  318. counterfeit IP address. To everyone on the network, it will
  319. appear that the "legitimate" user is active. If you follow this
  320. strategy, you may want to crack somehow more negligently... the
  321. search for the cracker will go on -later- in the false confidence
  322. that a sloppy novice (the legitimate user) is at work, this will
  323. muddle the waters a little more.
  324.  
  325. Well, that's it for this lesson, reader. Not all lessons of my
  326. tutorial are on the Web.
  327.  
  328.      You 'll obtain the missing lessons IF AND ONLY IF you mail
  329. me back (via anon.penet.fi) with some tricks of the trade I may
  330. not know that YOU discovered. Mostly I'll actually know them
  331. already, but if they are really new you'll be given full credit,
  332. and even if they are not, should I judge that you "rediscovered"
  333. them with your work, or that you actually did good work on them,
  334. I'll send you the remaining lessons nevertheless. Your
  335. suggestions and critics on the whole crap I wrote are also
  336. welcomed.
  337.  
  338.                                 E-mail +ORC
  339.  
  340.                         +ORC an526164@anon.penet.fi
  341.